﻿using Medianamik.Core.DAL.SQL;
using NUnit.Framework;

namespace Medianamik.Tests.Unit.Medianamik.Core.DAL.SQL
{
    [TestFixture]
    public class InnerJoinTest
    {
        private Table _table1;
        private Table _table2;
        [SetUp]
        public void Init()
        {
            _table1 = new Table("table1", "t1");
            _table1.AddColumn("col1");
            _table1.AddColumn("col2");

            _table2 = new Table("table2", "t2");
            _table2.AddColumn("col1");
            _table2.AddColumn("col2");
        }

        [Test]
        public void InnerJoinIsProperlyFormatted()
        {
            var from = new InnerJoin(_table1["col1"], _table2["col2"] );

            var expected = " INNER JOIN [dbo].[table1] t1 ON  t1.[col1]  =  t2.[col2] ";
            Assert.That(from.ToSQL().ToString(), Is.EqualTo(expected));
        }
    }
}